<html>
<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2024 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<HEAD>
    <script language="JavaScript" src="../ajax_inc/ajax.js"></script>
    <script language="JavaScript" src="../ajax_inc/proxy.vsp?wsdl_path=SOAP_SO_S_19/services.wsdl&xslt_type=complex"></script>
    <link rel="stylesheet" type="text/css" href="../demo.css" />
<SCRIPT language="JavaScript">

var uri = 'http://www.openlinksw.com/press/oplappl4.htm';
var browsertype;

if (document.implementation.createDocument)
{ 
    browsertype='Mozila';
   // Mozilla, create a new DOMParser 
   var parser = new DOMParser();
   var xsltProcessor = new XSLTProcessor(); 


    // load the xslt file
    var myXMLHTTPRequest = new XMLHttpRequest();
    myXMLHTTPRequest.open("GET", "contact.xsl", false);
    myXMLHTTPRequest.send(null);
    
    // parse XSLT text to XML DOM(when not local responseXML is set null ???)
    xslDoc = parser.parseFromString(myXMLHTTPRequest.responseText, "text/xml");
    xsltProcessor.importStylesheet(xslDoc);

}
else if (window.ActiveXObject)
{ 
  browsertype='IE';
  var xslDoc = new ActiveXObject("Microsoft.XMLDOM");
  var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  xslDoc.async = false;
  xmlDoc.async = false;
  xslDoc.load("contact.xsl");
}



function prepareContacts ()
{
  if (document.getElementById("uri").value != '')
  {
    uri = document.getElementById("uri").value.replace (/\&/, '&amp;');
     ajax.Start(Contacts,uri);
  }
  else
  {
    alert('You should provide URI.');
    return;
  }
}

function mResultsAjax(result)
{
  var styler = '';
  var i, l=0;
  var trf;

  l = result.item.length;
  styler = '<contacts ref="' + uri + '">'
  for (i = 0; i < l; i++)
	{
	  styler = styler + '<contact>'
	  styler = styler + '<name>'
	  styler = styler + result.item[i][0]
	  styler = styler + '</name>'
	  styler = styler + '<title>'
	  styler = styler + result.item[i][1]
	  styler = styler + '</title>'
	  styler = styler + '<company>'
	  styler = styler + result.item[i][2]
	  styler = styler + '</company>'
	  styler = styler + '<email>'
	  styler = styler + result.item[i][3]
	  styler = styler + '</email>'
	  styler = styler + '<web>'
	  styler = styler + result.item[i][4].replace (/\&/, '&amp;');
	  styler = styler + '</web>'
	  styler = styler + '</contact>'
  }
  if (l < 1)
	{
      styler = styler + '<no_contact/>'
	}
      styler = styler + '</contacts>'


     try
    	{
             if(browsertype=='IE')
             {
               xmlDoc.loadXML (styler);
               document.getElementById('divMenuToken').innerHTML = xmlDoc.transformNode(xslDoc.documentElement);
             }
             else
             {  
               xmlDoc = parser.parseFromString(styler, "text/xml");

         			 var resultDocument = xsltProcessor.transformToFragment(xmlDoc, document);
       				 document.getElementById("divMenuToken").innerHTML='';
       				 document.getElementById("divMenuToken").appendChild(resultDocument);
             }   
 	    }
      catch (e)
	    {
	        alert('Parser exception:'+e.description);
	    }
}

function dWait(dowhat){
  if(dowhat=='show'){
    document.getElementById('divWait').style.visibility='visible';
  }else{
    document.getElementById('divWait').style.visibility='hidden';
  }
}

</SCRIPT>
</HEAD>
<body>
<H3>Contact Extractor</H3>
<form method="POST" name="contacts">
<table class="tableentry">


<tr><td>1. Enter a URL</td><td>
<input type="text" name="uri" id="uri" value="http://www.openlinksw.com/press/oplappl4.htm" size="55">
</td></tr>
<tr><td>2. Extract Contacts</td><td><input type="button" name="exec" value="Extract" onClick="prepareContacts();"></td></tr>
</table>
<DIV ID="divMenuToken"></DIV>
</form>
<DIV ID="divWait" style="visibility:hidden;"><font color="red">Please wait...</font></DIV>
<br>Example Urls:
<pre>
http://www.openlinksw.com/press/oplappl4.htm
http://www.openlinksw.com/press/udast42.htm
http://www.interwoven.com/news/press/2001/1206impr.html
</pre>
      <script defer="defer" type="text/javascript">
          var Contacts = {
            delay: 200,
            prepare: function(encodeduri) {dWait('show');return Array(encodeduri);},
            call: proxies.SOAP.Contacts,
            finish: function(p){dWait('hide');mResultsAjax(p);},
            onException: proxies.alertException
          }
      </script>
</body>
</html>
